import Vue from "vue"
import router from "../router"
import store from "../store"
export default {
  mustBeLogin(){
    console.log("执行了mustBeLogin");
    let token = localStorage.getItem("token");
    if(!token){
      Vue.prototype.$toast("请先登录！");
      setTimeout(()=>{
        // isGoBack 改成true 
        // 调用muations中的chanIsGoBack方法，传一个参数true
        store["_mutations"]["isGoBack/chanIsGoBack"][0](true);
        // console.log(store);
        router.push("/user");
      },1000)
      return false
    }

    return true
  },

}